rm(list = ls())

library(tidyverse)

source(file = "./Code/Functions.R")

# Get log returns
set.seed(42)
lr <- get_log_returns(regime = "BS",
                      infl = 0.02,
                      MRP = 0.06,
                      delta = 0,
                      max_num_cont = 50,
                      N_sim = 1e+5,
                      r = .03)

cs <- Generate_Contract_Specs(logR = lr$logR,
                              r = lr$r,
                              mu_d_RN = lr$mu_d_RN, 
                              MRP = lr$MRP,
                              Cost_grid = c(0.002, 0.003, 0.005, 0.007))

save(cs, file = "./Code/Data/Contracts.RData")
save(lr, file = "./Code/Data/logR.RData")

Get_V_bins(CurrentAge = 25,
           CurrentAccountValue = 0000,
           InitialContributionAmount = 10000,
           RetirementAge = 65,
           AnnualCost = .002,
           logR = lr$logR,
           r = lr$r,
           infl = lr$infl,
           Cost_grid = cs$Cost_grid,
           con_type_vec = cs$con_type_vec,
           con_spec_vec = cs$con_spec_vec,
           con_cap_vec = cs$con_cap_vec)
